ls1 = []

for i in range(1, 11):
    ls1.append(i)
    lstr = "\n".join(map(str, ls1))
    with open("demo1.txt", "w") as f:
        f.write(lstr)
